{% extends 'base/base.html' %}
{% load static %}

{% block title %}积分明细 - 妙趣拾光锦盒{% endblock %}

{% block extra_css %}
<style>
    .points-header {
        background-color: #f0f7ff;
        border-radius: 10px;
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .points-value {
        font-size: 2.5rem;
        font-weight: bold;
        color: #ff6b6b;
    }
    
    .points-label {
        color: #6c757d;
        font-size: 1rem;
    }
    
    .point-item {
        border-radius: 10px;
        margin-bottom: 15px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        background-color: white;
        border-left: 5px solid #e9ecef;
    }
    
    .point-item.income {
        border-left-color: #28a745;
    }
    
    .point-item.expense {
        border-left-color: #dc3545;
    }
    
    .point-value {
        font-weight: bold;
        font-size: 1.2rem;
    }
    
    .point-value.income {
        color: #28a745;
    }
    
    .point-value.expense {
        color: #dc3545;
    }
    
    .point-time {
        color: #6c757d;
        font-size: 0.85rem;
    }
</style>
{% endblock %}

{% block content %}
<div class="container py-5">
    <div class="points-header d-flex justify-content-between align-items-center">
        <div>
            <h1 class="mb-3">积分明细</h1>
            <p class="text-muted mb-0">查看您的积分收支记录</p>
        </div>
        <div class="text-center">
            <div class="points-value">{{ user_points }}</div>
            <div class="points-label">当前积分</div>
            <a href="{% url 'points:index' %}" class="btn btn-sm btn-outline-primary mt-2">积分商城</a>
        </div>
    </div>
    
    <div class="row">
        <div class="col-12">
            {% for record in records %}
            <div class="point-item {% if record.mq_points > 0 %}income{% else %}expense{% endif %}">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <div class="fw-bold">{{ record.get_type_display }}</div>
                        <div class="text-muted small">{{ record.description }}</div>
                    </div>
                    <div class="text-end">
                        <div class="point-value {% if record.mq_points > 0 %}income{% else %}expense{% endif %}">
                            {% if record.mq_points > 0 %}+{% endif %}{{ record.mq_points }}
                        </div>
                        <div class="point-time">{{ record.create_time|date:"Y-m-d H:i" }}</div>
                    </div>
                </div>
            </div>
            {% empty %}
            <div class="text-center py-5">
                <p class="text-muted">暂无积分记录</p>
            </div>
            {% endfor %}
        </div>
    </div>
</div>
{% endblock %}
